<?php
class Q_Rule_Digits extends Q_Rule_Abstract {

    /**
     * The parameters that were passed to this rule
     */
    protected $_params = array(
        'field' => 0, // default is zero because this allows $rule->validate('some text')
        'whitespace' => false,
    );
    public function isValid($value) {
    
        $pattern = ($this->getParam('whitespace')) ? '/^[0-9\s]+$/' : '/^[0-9]+$/';
        return preg_match($pattern, $value);
    
    }

}